package com.atcper

import scala.Console.println
import scala.collection.mutable.ArrayBuffer

/**
 * @author : ranzlupup
 * @date : 2023/2/22 08:39
 */
object Scala09_Recursion {


    def main(args: Array[String]): Unit = {

        /**
         * Scala中使用while(true)实现尾递归
         */
        def test(number: Int): Int = {
            if (number <= 1) {
                1
            } else {
                number * test(number - 1)
            }
        }

        println(test(9))
    }
}
